﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Ajax.views
{
    public partial class WebFormMatchNames : System.Web.UI.Page
    {
        static List<string> listNames = new List<string>
        {
            "Vicky",
            "Anna",
            "Brittany",
            "Cinderel",
            "Diana",
            "Eva",
            "Fiona",
            "Gunda",
            "Hege",
            "Inga",
            "Johanna",
            "Kitty",
            "Linda",
            "Nina",
            "Ophelia",
            "Petunia",
            "Amanda",
            "Raquel",
            "Cindy",
            "Doris",
            "Eve",
            "Evita",
            "Sunniva",
            "Tove",
            "Unni",
            "Violet",
            "Liza",
            "Elizabe",
            "Ellen",
            "Wenche"
        };
        protected void Page_Load(object sender, EventArgs e)
        {
            GetString();
            new List<object>
            {
                new { a="" }
            };
            
        }

        void GetString()
        {
            string queryString = Request.QueryString["q"] ?? String.Empty;

            if (queryString.Length > 0)
            {
                queryString = queryString.ToLower();
                var listMatch = listNames.Where(p => p.ToLower().Contains(queryString));

                if (queryString != null && queryString.Length > 0)
                {
                    Response.Write(String.Join(";", listMatch));
                }
                else
                {
                    Response.Write("无匹配项");
                }
            }
        }
    }
}